my_list = []
sum_list = 0
square = []
while my_list != 0:
    my_list.append(int(input()))
    sum_list = sum(my_list)
    for i in my_list:
        square.append(i*i)
    if sum_list == 0:
        break

        print (sum(square))